package org.particlethink.response;

import io.swagger.v3.oas.annotations.media.Schema;
import org.particlethink.entry.BillStatus;
import org.particlethink.model.Bill;
import org.particlethink.model.Project;
import org.particlethink.model.ProjectUser;
import org.particlethink.model.Supplier;

import java.util.Date;

public class BillResponse {
    @Schema(description = "项目id")
    private int id;
    @Schema(description = "对账单号")
    private String no;
    @Schema(description = "项目（合同买受方）")
    private ProjectResponse project;//项目id
    @Schema(description = "合同出售方")
    private SupplierResponse supplier;//项目id
    @Schema(description = "对账周期 开始时间")
    private Date startAt;//开始时间
    @Schema(description = "对账周期 结束时间")
    private Date endAt;//结束时间
    @Schema(description = "状态 int 1:待确认;2:供应商异议;3:已确认;4:已作废")
    private BillStatus status;

    @Schema(description = "创建人")
    private ProjectUserResponse creator;//创建者id 项目人员
    @Schema(description = "创建时间")
    private Date createdAt;
    @Schema(description = "扣款金额")
    private Float deductionAmount; //扣款金额
    @Schema(description = "扣款事由")
    private String deductionReason;// 扣款事由
    @Schema(description = "奖励金额")
    private Float rewardAmount; //  奖励金额
    @Schema(description = "奖励事由")
    private String rewardReason;//  奖励事由

    @Schema(description = "供货商备注")
    private String supplierRemark;//供货商备注
    @Schema(description = "项目备注")
    private String projectRemark;//项目备注

    public BillResponse(Bill bill, Project project, Supplier supplier, ProjectUser creator) {
        this.id = bill.getId();
        this.no = bill.getNo();
        this.project = project == null ? null : new ProjectResponse(project);
        this.supplier = supplier == null ? null : new SupplierResponse(supplier);
        this.startAt = bill.getStartAt();
        this.endAt = bill.getEndAt();
        this.status = bill.getStatus();
        this.creator = creator == null ? null : new ProjectUserResponse(creator);
        this.createdAt = bill.getCreatedAt();
        this.deductionAmount = bill.getDeductionAmount() == null ? 0 : bill.getDeductionAmount();
        this.deductionReason = bill.getDeductionReason() == null ? null : bill.getDeductionReason();
        this.rewardAmount = bill.getRewardAmount() == null ? 0 : bill.getRewardAmount();
        this.rewardReason = bill.getRewardReason() == null ? null : bill.getRewardReason();
        this.projectRemark = bill.getProjectRemark() == null ? null : bill.getProjectRemark();
        this.supplierRemark = bill.getSupplierRemark() == null ? null : bill.getSupplierRemark();
    }


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public ProjectResponse getProject() {
        return project;
    }

    public void setProject(ProjectResponse project) {
        this.project = project;
    }

    public SupplierResponse getSupplier() {
        return supplier;
    }

    public void setSupplier(SupplierResponse supplier) {
        this.supplier = supplier;
    }

    public Date getStartAt() {
        return startAt;
    }

    public void setStartAt(Date startAt) {
        this.startAt = startAt;
    }

    public Date getEndAt() {
        return endAt;
    }

    public void setEndAt(Date endAt) {
        this.endAt = endAt;
    }

    public BillStatus getStatus() {
        return status;
    }

    public void setStatus(BillStatus status) {
        this.status = status;
    }


    public String getDeductionReason() {
        return deductionReason;
    }

    public void setDeductionReason(String deductionReason) {
        this.deductionReason = deductionReason;
    }


    public String getRewardReason() {
        return rewardReason;
    }

    public void setRewardReason(String rewardReason) {
        this.rewardReason = rewardReason;
    }

    public ProjectUserResponse getCreator() {
        return creator;
    }

    public void setCreator(ProjectUserResponse creator) {
        this.creator = creator;
    }

    public String getSupplierRemark() {
        return supplierRemark;
    }

    public void setSupplierRemark(String supplierRemark) {
        this.supplierRemark = supplierRemark;
    }

    public String getProjectRemark() {
        return projectRemark;
    }

    public void setProjectRemark(String projectRemark) {
        this.projectRemark = projectRemark;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Float getDeductionAmount() {
        return deductionAmount;
    }

    public void setDeductionAmount(Float deductionAmount) {
        this.deductionAmount = deductionAmount;
    }

    public Float getRewardAmount() {
        return rewardAmount;
    }

    public void setRewardAmount(Float rewardAmount) {
        this.rewardAmount = rewardAmount;
    }
}
